package com.fu.sql;

import com.fu.bean.Student;
import org.apache.ibatis.jdbc.SQL;

/**
 * @author 付大大
 * @description
 * @create 2021-02-02 14:08
 */
public class ReturnSql {

    public String getSelectAll() {
        String sql = new SQL() {
            {
                SELECT("*");
                FROM("student");
            }
        }.toString();
        return sql;
    }

    public String getInsert(Student student) {
        return new SQL() {{
            INSERT_INTO("student");
            INTO_VALUES("#{id},#{name},#{age}");
        }}.toString();
    }


    public String getUpdate(Student student) {
        return new SQL() {{
            UPDATE("student");
            SET("name=#{name},age=#{age}");
            WHERE("id=#{id}");
        }}.toString();
    }


    public String getDelete(Integer id) {
        return new SQL() {{
            DELETE_FROM("student");
            WHERE("id=#{id}");
        }}.toString();
    }
}
